package com.szms.mobile.dto;

public class ResultDto<T> {

    private Boolean success;

    private String message;

    private T data;

    public Boolean isSuccess() {
        return success;
    }

    public String getMessage() {
        return message;
    }

    public T getData() {
        return data;
    }

    public static <T> ResultDto<T> success(T data){
        ResultDto re = new ResultDto<>();
        re.success = true;
        re.data = data;
        return re;
    }

    public static <T> ResultDto<T> success(){
        ResultDto re = new ResultDto<>();
        re.success = true;
        return re;
    }

    public static <T> ResultDto<T> error(String message){
        ResultDto re = new ResultDto<>();
        re.success = false;
        re.message = message;
        return re;
    }
}
